<template>
	<div>
		<AplidForm v-model="formModel" v-bind="formConfig" ref="searchRef" @reset="onReset" @submit="onSubmit">
			<template v-slot:appealReasonFormLabel>
				<el-popover :width="600" placement="left">
					<template #reference>
						<icon-help theme="outline" fill="#f00" style="margin-left: 4px" />
					</template>
					<template #default>
						<div class="demo-rich-conent" style="display: flex; gap: 16px; flex-direction: column">
							<p>申诉原因：可参考以下几种： 1、数据输入错误：如老人姓名输入错误、老人地址输入错误等误操作情况</p>
							<p>2、数据更新滞后：如殡葬老人、失能险老人数据没有及时更新</p>
							<p>3、误解数据含义：如所属地区、所在地区概念混淆</p>
							<p>4、外部因素：如民政领导层、服务组织负责人、服务人员、老人特殊要求引起的数据导致比对结果偏差</p>
							<p>5、操作失误：如服务人员再进行服务的时候服务错误老人，认错老人或业务开展错误。</p>
							<p>6、政策要求变更：如新发行的政策文件、或区发行的政策文件要求变动</p>
							<p>7、数据源差异：如老人信息从区、街道、社区或公安等部门获取到的信息之间的差异导致的比对结果偏差</p>
							<p>8、个人信息变更：如服务人员、老人个人或企业信息发生变动、如地址、联系方式等导致原有数据不准确。</p>
							<p>9、比对逻辑不一致：如区层面比对逻辑与市层面比对逻辑可能存在不一致，导致比对结果偏差</p>
						</div>
					</template>
				</el-popover>
			</template>
		</AplidForm>
	</div>
</template>

<script setup lang="ts">
import { uploadType } from '@/utils/util'
import apiMod from '@/apiMod/index'

const props = defineProps<{
	multipleSelection?: any
  fromType?:string|number
}>()

const emit = defineEmits(['refresh'])

const formModel = ref({})

const formConfig = {
	inline: false,
	showBtn: true,
	labelPosition: 'top',
	labelWidth: '120px',
	column: [
		{
			label: '申诉原因',
			prop: 'appealReason',
			propName: 'appealReasonLabel',
			api: 'geiDictItemList',
			type: 'remoteSelect',
			code: 'APPEAL_REASON',
			span: 24,
			rules: [{ required: true, message: '请选择申诉原因' }],
		},
		{
			label: '申诉证明材料',
			prop: 'appealMaterial',
			type: 'upload',
			fileType: uploadType.fileMetaType,
			listType: 'picture-card',
			labelPosition: 'top',
			showFileList: true,
			limit: 4,
			multiple: true,
			span: 24,
			rules: [{ required: true, message: '请上传申诉证明材料' }],
		},
    {
			label: '申诉单位所在详细地址',
			prop: 'orgAddress',
			type: 'text',
			span: 12,
			rules: [{ required: true, message: '请输入申诉单位所在详细地址' }],
		},
		{
			label: '申诉说明',
			prop: 'appealDescribe',
			maxlength: '140',
			showWordLimit: true,
			type: 'textarea',
			span: 24,
			rules: [{ required: true, message: '请输入申诉说明' }],
		},
	],
}

const onReset = () => {
  emit('refresh')
}
const onSubmit = (form, done) => {
	const omAppealList = props.multipleSelection.map((item) => {
		return {
			fromId: item.dataId||item.fromId,
			batchNo: item.batchNo,
			orderBatchNo: item.orderBatchNo,
			orderNo: item.orderNo,
			fromType: props.fromType,
		}
	})
	apiMod
		.view_omAppeal_addBatch({
			...form,
			omAppealList,
			fromType: props.fromType,
		})
		.then((res) => {
			ElMessage.success('操作成功！')
      emit('refresh')
			done()
		})
		.catch(() => {
			done()
		})
}
</script>

<style scoped></style>
